package cn.leyaber.hrm.service.impl;

import cn.leyaber.hrm.domain.GoodsDetail;
import cn.leyaber.hrm.mapper.GoodsDetailMapper;
import cn.leyaber.hrm.redusutils.constants.CommentConstant;
import cn.leyaber.hrm.service.IGoodsDetailService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ma.rui.kai
 * @since 2020-12-11
 */
@Service
public class GoodsDetailServiceImpl extends ServiceImpl<GoodsDetailMapper, GoodsDetail> implements IGoodsDetailService {
     @Autowired
     private GoodsDetailMapper goodsDetailMapper;
    /**
     * 修改状态
     * @param goodsDetail
     */
    @Override
    public void Modify_status(GoodsDetail goodsDetail) {
        if (goodsDetail.getState().equals(CommentConstant.COMMENT_DISABLE)){
            goodsDetail.setState(CommentConstant.COMMENT_ENABLE);
            goodsDetailMapper.updateById(goodsDetail);
        }else {
            goodsDetail.setState(CommentConstant.COMMENT_ENABLE);
            goodsDetailMapper.updateById(goodsDetail);
        }
    }

    @Override
    public void batchDelete(List<Long> ids) {
        System.out.println(ids);
        goodsDetailMapper.batchDelete(ids);
    }
}
